using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.Contracts;


namespace FoundationLib.Ifc.Data 
{
	/// <summary>
	/// Provides an interface for an entity repository
	/// </summary>
	public interface IRepository<TEntity>  
	{
		/// <summary>
		/// Adds the given entity to the repository
		/// </summary>
		/// <param name="instance">The entity to be added</param>
		void Add(TEntity instance);

		/// <summary>
		/// Gets the entity with the given unique identifier from the repository
		/// </summary>
		/// <returns>The entity or null if none was found for the given key</returns>
		/// <param name="key">the unique entity key</param>
		TEntity Get(object key);

		/// <summary>
		/// Removes the given entity from the repository
		/// </summary>
		/// <returns>True if the entity has been removed, false otherwise</returns>
		/// <param name="entity"></param>
		bool Remove(TEntity entity);

		/// <summary>
		/// Submits all changes in the repository to the underlying data store
		/// </summary>
		void SubmitChanges();
	}

}